// 输出：7, nums = [0, 0, 1, 1, 2, 3, 3]
// 解释：函数应返回新长度 length = 7, 并且原数组的前七个元素被修改为 0, 0, 1, 1, 2, 3, 3。不需要考虑数组中超出新长度后面的元素。

nums = [0, 0, 1, 1, 1, 1, 2, 3, 3]

var removeDuplicates = function (nums) {
    let len = nums.length
    if (len <= 2) return len
    let slow = 2, fast = 2
    while (fast < len) {
        if (nums[fast] !== nums[slow - 2]) {
            nums[slow] = nums[fast]
            slow++
        }
        fast++
    }
    console.log(nums);

    return slow
};
console.log(removeDuplicates(nums));
